<html>
<head>
	<meta charset="UTF-8">
	<title>处理管理员登录页面</title>
</head>
<body>
	<?php 
          //接收表单数据；连接数据库，查询admins表进行信息的比对；能比对成功就跳转到welcome页，失败就返回登录页重新登陆。
          mysql_connect("localhost","root","");
          mysql_select_db("neuvideo");
          mysql_set_charset("utf8");

       
        $adminname=$_POST["adminname"];
        $password=$_POST["password"];

        $sql="select * from admins where adminname='$adminname' and password=md5('$password')";
        echo $sql."<br>";

        $result=mysql_query($sql);//结果集类型
        $num=mysql_num_rows($result);//判断查到的语句数
        if ($num>0) {

            $row=mysql_fetch_assoc($result);


          session_start();//启动会话
          $_SESSION["adminname"]=$adminname;
          $_SESSION["adminid"]=$row["adminid"];


        	echo "login success";
        	header("location:welcome.php");
        }else{
        	echo "login failed";
        	header("location:index.php");
        }
      





	 ?>
</body>
</html>